package com.yeung.alo;

import com.yeung.exam.ReadUtils;

import java.util.Scanner;

public class 逆序数 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Integer num = Integer.valueOf(sc.nextLine());
        int[] number = ReadUtils.str2Int(sc.nextLine(), " ");
        long revNums = 0;
        for (int i = 0; i < number.length; i++)
            for (int j = 0; j < i; j++) {
                if (number[j] > number[i]) revNums += 1;
            }
        System.out.println(revNums);
    }
}
